Building the Logic > Preemption Process Logic

Preemption Process Logic

With Preemption Process Logic, MedModel makes it possible to control preemption rather than limit you to default preemption priority levels and values. This feature pertains only to the preemption of entities using a location. It does not include preemption of downtimes.

 

Normally, if an entity or downtime attempts to preempt an entity that is using a location, the location is immediately preempted (assuming it is preemptable). Once the location finishes the preempting activity, the original preempted entity regains possession of the location and resumes processing where it left off.

 

To override this default preemption procedure, in the case of entities that are preempted by another entity or a downtime, MedModel allows a Preemption Process Record to be defined which postpones the actual preemption of the location until after the current entity explicitly releases it.

 

The Preemption Process Record, allows you to control if and when the location is given up. In the case of a preemptive request for a location, the preemption process record allows the entity to be routed elsewhere if desired. If a preemption process is defined, the actual preemption does not occur until the preemption process explicitly frees the location.

 

After the location is given up, the entity may (1) elect to use an alternative location to complete the process, or (2) seek to regain access to the same location to complete the process.

 

While an entity is executing a preemption process, it cannot be preempted by any other entity or downtime.

How to create a preemption process record:

  1. Using the same entity and location names, create a process record somewhere following the process record where the preemption may occur.

  1. Click on the Entity button to display the Entities dialog shown here.

  1. Check the Preemption Process option box and click OK.
  2. Click on the Operation button to enter the preemption logic. You can use any valid operation logic including delays. It is recommended that you enter a comment as the first line in the logic indicating that this is a preemption process. This will make the record easily identifiable as a preemption process.

Please Note: When a preemption occurs, the entity looks forward and then from the beginning of the process list trying to find a preemption process that matches the same entity and location (a process with ALL as the entity name will match any entity). If a match is found, the preemption process gets executed. Otherwise the default preemption occurs. Only the first preemption process encountered will be executed in the event that multiple preemption processes are defined with the same entity and location names.

Possible Effects of Delayed Preemption

Several circumstances can be created through the use of preemption process records. An entity delaying a preemption, for example, may find at the conclusion of the delay that the preemption is no longer required, or that it faces an even higher preemption priority.

 

In cases where an entity has multiple locations or resources from which to choose, a preemptive request for any one of them is not necessarily a commitment to select that particular location. If any of the alternative locations becomes available, the entity will select it and withdraw the preemption request.

Functions for Defining Logic in a Preemption Process

The Preemption Process Logic feature includes the following functions for use in the preemption logic.

 

PREEMPTOR() Identifies whether a downtime or entity is making the preemptive request. It returns a 0 if the preemptor is a downtime, otherwise it returns the index number of the preempting entity.

 

TIMELEFT() Returns the amount of time remaining if the preemption occurred during a WAIT or USE statement. It returns a time value in default time units (real). If multiple entities are preempted from a location, it returns the longest remaining time for all of the entities.

Please Note: The values returned by these functions must be checked before any processing delay occurs since they are updated whenever a preemption takes place. If the values must be referred to later, they should be assigned to the entity’s attribute or to a local variable.


© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com